﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WebSite.Helpers
{
    public static class HelperCollection
    {
        public static List<SelectListItem> ToSelectListItem<T>(
          this IEnumerable<T> enumerable,
          Func<T, string> getText,
          Func<T, string> getValue)
        {

            return enumerable
              .Select(x => new SelectListItem { Text = getText(x), Value = getValue(x) })
              .ToList();
        }
    }
}